#ifndef CENTRALCOLUMNSOLVER_H
#define CENTRALCOLUMNSOLVER_H

#include "Data.h"
#include "Result.h"
#include "Typedefs.h"
#include <vector>
using namespace std;
class CentralColumnSolver
{
    public:
        CentralColumnSolver();
        virtual ~CentralColumnSolver();
        void solve_MCS(const Data * data, Result & result, const s_rect & rect, int central_column);
        void solve_MCS_optim(const Data * original_data,  Result & result, const s_rect & rect,
                                    int central_column);

    protected:
    private:
    void substract_row_with_row( vector <int> & plus_row, const vector<int> & minus_row);
    void initialize_matrix(int local_y1, int left_x, const s_rect & rect, vector< vector <int> > & accumulator_left,
                  vector< vector <int> > &accumulator_right, Result & best_result);
    void update_matrix(int local_y1, int left_x, const s_rect & rect,
                                         vector< vector <int> > & accumulator_left,
                  vector< vector <int> > &accumulator_right, Result & best_result);
        void find_max_and_index(const vector <int > & accumulator, int & max,
                                             int & dist_from_center);
        void update_result(Result & result, t_int x0, t_int y0, t_int x1, t_int y1, t_int sum);
        void initialize_accumulators(Result & best_result,
                                                  vector<int> & accumulator_left, vector<int> & accumulator_right,
                                                  int left_x, int local_y1, int left_limit_x, int right_limit_x);
        const Data * data_ptr;
        const Mat * mat_ptr;
        /*
        int local_accumulator_left;
        int local_accumulator_right;
        vector<int> accumulator_left;
        vector<int> accumulator_right;
        Result best_result;
        Result left_result;
        Result right_result;
        */
};

#endif // CENTRALCOLUMNSOLVER_H
